package org.wang.gift.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.wang.gift.dto.SmsCodeDto;
import org.wang.gift.service.IVerifyCodeService;
import org.wang.gift.util.AjaxResult;

import javax.validation.Valid;

@RestController
@RequestMapping("/sms")
public class ValidateCodeController {
    @Autowired
    private IVerifyCodeService verifyCodeService;
    @PostMapping("/register/{mobile}")
    public AjaxResult sendSmsCodeRegister(@PathVariable("mobile") String mobile){
        return verifyCodeService.sendSmsCodeRegister(mobile);
    }
    @PostMapping("/validation")
    public AjaxResult validationSmsCode(@RequestBody @Valid SmsCodeDto smsCodeDto){
        return verifyCodeService.validationSmsCode(smsCodeDto);
    }
}
